home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / ixemul / sdk / man / cat7 / mdoc.samples.0 < prev    next >
Encoding:
Text File  |  1998-06-15  |  68.3 KB  |  1,470 lines

  1.  
  2. MDOC.SAMPLES(7)              UNIX Reference Manual             MDOC.SAMPLES(7)
  3.  
  4. NNAAMMEE
  5.      mmddoocc..ssaammpplleess - tutorial sampler for writing BSD UNIX manuals with --mmddoocc
  6.  
  7. SSYYNNOOPPSSIISS
  8.      mmaann mmddoocc..ssaammpplleess
  9.  
  10. DDEESSCCRRIIPPTTIIOONN
  11.      A tutorial sampler for writing BSD UNIX manual pages with the --mmddoocc macro
  12.      package, a _c_o_n_t_e_n_t-based and _d_o_m_a_i_n-based formatting package for
  13.      troff(1).  Its predecessor, the -man(7) package, addressed page layout
  14.      leaving the manipulation of fonts and other typesetting details to the
  15.      individual author.  In --mmddoocc, page layout macros make up the _p_a_g_e
  16.      _s_t_r_u_c_t_u_r_e _d_o_m_a_i_n which consists of macros for titles, section headers,
  17.      displays and lists. Essentially items which affect the physical position
  18.      of text on a formatted page.  In addition to the page structure domain,
  19.      there are two more domains, the manual domain and the general text do-
  20.      main.  The general text domain is defined as macros which perform tasks
  21.      such as quoting or emphasizing pieces of text.  The manual domain is de-
  22.      fined as macros that are a subset of the day to day informal language
  23.      used to describe commands, routines and related BSD UNIX files.  Macros
  24.      in the manual domain handle command names, command line arguments and op-
  25.      tions, function names, function parameters, pathnames, variables, cross
  26.      references to other manual pages, and so on.  These domain items have
  27.      value for both the author and the future user of the manual page.  It is
  28.      hoped the consistency gained across the manual set will provide easier
  29.      translation to future documentation tools.
  30.  
  31.      Throughout the UNIX manual pages, a manual entry is simply referred to as
  32.      a man page, regardless of actual length and without sexist intention.
  33.  
  34. GGEETTTTIINNGG SSTTAARRTTEEDD
  35.      Since a tutorial document is normally read when a person desires to use
  36.      the material immediately, the assumption has been made that the user of
  37.      this document may be impatient.  The material presented in the remained
  38.      of this document is outlined as follows:
  39.  
  40.            1.   TROFF IDIOSYNCRASIES
  41.                       Macro Usage.
  42.                       Passing Space Characters in an Argument.
  43.                       Trailing Blank Space Characters (a warning).
  44.                       Escaping Special Characters.
  45.  
  46.            2.   THE ANATOMY OF A MAN PAGE
  47.                       A manual page template.
  48.  
  49.            3.   INTRODUCTION OF TITLE MACROS.
  50.  
  51.            4.   INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS.
  52.                       What's in a name....
  53.                       General Syntax.
  54.  
  55.            5.   MANUAL DOMAIN
  56.                       Addresses.
  57.                       Arguments.
  58.                       Configuration Declarations (section four only).
  59.                       Command Modifier .
  60.                       Defined Variables.
  61.                       Errno's (Section two only).
  62.                       Environment Variables.
  63.                       Function Argument.
  64.  
  65.  
  66.                       Function Declaration.
  67.                       Flags.
  68.                       Functions (library routines).
  69.                       Function Types.
  70.                       Interactive Commands.
  71.                       Literals.
  72.                       Names.
  73.                       Options.
  74.                       Pathnames.
  75.                       Variables.
  76.                       Cross References.
  77.  
  78.            6.   GENERAL TEXT DOMAIN
  79.                       AT&T Macro.
  80.                       BSD Macro.
  81.                       UNIX Macro.
  82.                       Emphasis Macro.
  83.                       Enclosure/Quoting Macros
  84.                                   Angle Bracket Quote/Enclosure.
  85.                                   Bracket Quotes/Enclosure.
  86.                                   Double Quote macro/Enclosure.
  87.                                   Parenthesis Quote/Enclosure.
  88.                                   Single Quotes/Enclosure.
  89.                                   Prefix Macro.
  90.                       Extended  Arguments.
  91.                       No-Op or Normal Text Macro.
  92.                       No Space Macro.
  93.                       Section Cross References.
  94.                       Symbolic Macro.
  95.                       References and Citations.
  96.                       Trade Names (Acronyms and Type Names).
  97.  
  98.            7.   PAGE STRUCTURE DOMAIN
  99.                       Section Headers.
  100.                       Paragraphs and Line Spacing.
  101.                       Keeps.
  102.                       Displays.
  103.                       Lists and Columns.
  104.  
  105.            8.   PREDEFINED STRINGS
  106.  
  107.            9.   DIAGNOSTICS
  108.  
  109.            10.  FORMATTING WITH GROFF, TROFF AND NROFF
  110.  
  111.            11.  BUGS
  112.  
  113. TTRROOFFFF IIDDIIOOSSYYNNCCRRAASSIIEESS
  114.      The --mmddoocc package attempts to simplify the process of writing a man page.
  115.      Theoretically, one should not have to learn the dirty details of troff(1)
  116.      to use --mmddoocc; however, there are a few limitations which are unavoidable
  117.      and best gotten out of the way.  And, too, be forewarned, this package is
  118.      _n_o_t fast.
  119.  
  120.    MMaaccrroo UUssaaggee
  121.      As in troff(1),  a macro is called by placing a `.' (dot character) at
  122.      the beginning of a line followed by the two character name for the macro.
  123.      Arguments may follow the macro separated by spaces.  It is the dot char-
  124.      acter at the beginning of the line which causes troff(1) to interpret the
  125.      next two characters as a macro name.  To place a `.' (dot character) at
  126.      the beginning of a line in some context other than a macro invocation,
  127.      precede the `.' (dot) with the `\&' escape sequence.  The `\&' translates
  128.      literally to a zero width space, and is never displayed in the output.
  129.  
  130.      In general, troff(1) macros accept up to nine arguments, any extra argu-
  131.      ments are ignored.  Most macros in --mmddoocc accept nine arguments and, in
  132.      limited cases, arguments may be continued or extended on the next line
  133.      (See _E_x_t_e_n_s_i_o_n_s). A few macros handle quoted arguments (see _P_a_s_s_i_n_g _S_p_a_c_e
  134.      _C_h_a_r_a_c_t_e_r_s _i_n _a_n _A_r_g_u_m_e_n_t below).
  135.  
  136.      Most of the --mmddoocc general text domain and manual domain macros are spe-
  137.      cial in that their argument lists are _p_a_r_s_e_d for callable macro names.
  138.      This means an argument on the argument list which matches a general text
  139.      or manual domain macro name and is determined to be callable will be exe-
  140.      cuted or called when it is processed.  In this case the argument, al-
  141.      though the name of a macro, is not preceded by a `.' (dot).  It is in
  142.      this manner that many macros are nested; for example the option macro,
  143.      `.Op', may _c_a_l_l the flag and argument macros, `Fl' and `Ar', to specify
  144.      an optional flag with an argument:
  145.  
  146.            [--ss _b_y_t_e_s]         is produced by .Op Fl s Ar bytes
  147.  
  148.      To prevent a two character string from being interpreted as a macro name,
  149.      precede the string with the escape sequence `\&':
  150.  
  151.            [Fl s Ar bytes]    is produced by .Op \&Fl s \&Ar bytes
  152.  
  153.      Here the strings `Fl' and `Ar' are not interpreted as macros.  Macros
  154.      whose argument lists are parsed for callable arguments are referred to as
  155.      parsed and macros which may be called from an argument list are referred
  156.      to as callable throughout this document and in the companion quick refer-
  157.      ence manual mdoc(7).  This is a technical _f_a_u_x _p_a_s as almost all of the
  158.      macros in --mmddoocc are parsed, but as it was cumbersome to constantly refer
  159.      to macros as being callable and being able to call other macros, the term
  160.      parsed has been used.
  161.  
  162.    PPaassssiinngg SSppaaccee CChhaarraacctteerrss iinn aann AArrgguummeenntt
  163.      Sometimes it is desirable to give as one argument a string containing one
  164.      or more blank space characters.  This may be necessary to defeat the nine
  165.      argument limit or to specify arguments to macros which expect particular
  166.      arrangement of items in the argument list.  For example, the function
  167.      macro `.Fn' expects the first argument to be the name of a function and
  168.      any remaining arguments to be function parameters.  As ANSI C stipulates
  169.      the declaration of function parameters in the parenthesized parameter
  170.      list, each parameter is guaranteed to be at minimum a two word string.
  171.      For example, _i_n_t _f_o_o.
  172.  
  173.      There are two possible ways to pass an argument which contains an embed-
  174.      ded space.  _I_m_p_l_e_m_e_n_t_a_t_i_o_n _n_o_t_e: Unfortunately, the most convenient way
  175.      of passing spaces in between quotes by reassigning individual arguments
  176.      before parsing was fairly expensive speed wise and space wise to imple-
  177.      ment in all the macros for AT&T troff.  It is not expensive for groff but
  178.      for the sake of portability, has been limited to the following macros
  179.      which need it the most:
  180.  
  181.            Cd    Configuration declaration (section 4 _S_Y_N_O_P_S_I_S)
  182.            Bl    Begin list (for the width specifier).
  183.            Em    Emphasized text.
  184.            Fn    Functions (sections two and four).
  185.            It    List items.
  186.            Li    Literal text.
  187.            Sy    Symbolic text.
  188.            %B    Book titles.
  189.            %J    Journal names.
  190.            %O    Optional notes for a reference.
  191.            %R    Report title (in a reference).
  192.            %T    Title of article in a book or journal.
  193.  
  194.      One way of passing a string containing blank spaces is to use the hard or
  195.      unpaddable space character `\ ', that is, a blank space preceded by the
  196.      escape character `\'. This method may be used with any macro but has the
  197.      side effect of interfering with the adjustment of text over the length of
  198.      a line.  Troff sees the hard space as if it were any other printable
  199.      character and cannot split the string into blank or newline separated
  200.      pieces as one would expect.  The method is useful for strings which are
  201.      not expected to overlap a line boundary.  For example:
  202.  
  203.            ffeettcchh(_c_h_a_r _*_s_t_r)  is created by `.Fn fetch char\ *str'
  204.  
  205.            ffeettcchh(_c_h_a_r _*_s_t_r)  can also be created by `.Fn fetch "*char *str"'
  206.  
  207.      If the `\' or quotes were omitted, `.Fn' would see three arguments and
  208.      the result would be:
  209.  
  210.            ffeettcchh(_c_h_a_r, _*_s_t_r)
  211.  
  212.      For an example of what happens when the parameter list overlaps a newline
  213.      boundary, see the _B_U_G_S section.
  214.  
  215.    TTrraaiilliinngg BBllaannkk SSppaaccee CChhaarraacctteerrss
  216.      Troff can be confused by blank space characters at the end of a line.  It
  217.      is a wise preventive measure to globally remove all blank spaces from
  218.      <blank-space><end-of-line> character sequences.  Should the need arise to
  219.      force a blank character at the end of a line, it may be forced with an
  220.      unpaddable space and the `\&' escape character.  For example,
  221.      `string\ \&'.
  222.  
  223.    EEssccaappiinngg SSppeecciiaall CChhaarraacctteerrss
  224.      Special characters like the newline character `\n', are handled by re-
  225.      placing the `\' with `\e' (e.g.  `\en') to preserve the backslash.
  226.  
  227. TTHHEE AANNAATTOOMMYY OOFF AA MMAANN PPAAGGEE
  228.      The body of a man page is easily constructed from a basic template found
  229.      in the file:
  230.  
  231.            .\" /usr/share/misc/man.template:
  232.            .\" The following six lines are required.
  233.            .Dd Month day, year
  234.            .Os OPERATING_SYSTEM [version/release]
  235.            .Dt DOCUMENT_TITLE [section number] [volume]
  236.            .Sh NAME
  237.            .Sh SYNOPSIS
  238.            .Sh DESCRIPTION
  239.            .\" The following requests should be uncommented and
  240.            .\" used where appropriate.  This next request is
  241.            .\" for sections 2 and 3 function return values only.
  242.            .\" .Sh RETURN VALUES
  243.            .\" This next request is for sections 1, 6, 7 & 8 only
  244.            .\" .Sh ENVIRONMENT
  245.            .\" .Sh FILES
  246.            .\" .Sh EXAMPLES
  247.            .\" This next request is for sections 1, 6, 7 & 8 only
  248.            .\"     (command return values (to shell) and
  249.            .\"       fprintf/stderr type diagnostics)
  250.            .\" .Sh DIAGNOSTICS
  251.            .\" The next request is for sections 2 and 3 error
  252.            .\" and signal handling only.
  253.            .\" .Sh ERRORS
  254.            .\" .Sh SEE ALSO
  255.            .\" .Sh STANDARDS
  256.            .\" .Sh HISTORY
  257.            .\" .Sh AUTHORS
  258.            .\" .Sh BUGS
  259.  
  260.      The first items in the template are the macros (.Dd, .Os, .Dt); the docu-
  261.      ment date, the operating system the man page or subject source is devel-
  262.      oped or modified for, and the man page title (_i_n _u_p_p_e_r _c_a_s_e) along with
  263.      the section of the manual the page belongs in.  These macros identify the
  264.      page, and are discussed below in _T_I_T_L_E _M_A_C_R_O_S.
  265.  
  266.      The remaining items in the template are section headers (.Sh); of which
  267.      _N_A_M_E, _S_Y_N_O_P_S_I_S and _D_E_S_C_R_I_P_T_I_O_N are mandatory.  The headers are discussed
  268.      in _P_A_G_E _S_T_R_U_C_T_U_R_E _D_O_M_A_I_N, after presentation of _M_A_N_U_A_L _D_O_M_A_I_N. Several
  269.      content macros are used to demonstrate page layout macros; reading about
  270.      content macros before page layout macros is recommended.
  271.  
  272. TTIITTLLEE MMAACCRROOSS
  273.      The title macros are the first portion of the page structure domain, but
  274.      are presented first and separate for someone who wishes to start writing
  275.      a man page yesterday.  Three header macros designate the document title
  276.      or manual page title, the operating system, and the date of authorship.
  277.      These macros are one called once at the very beginning of the document
  278.      and are used to construct the headers and footers only.
  279.  
  280.      .Dt DOCUMENT_TITLE section# [volume]
  281.              The document title is the subject of the man page and must be in
  282.              CAPITALS due to troff limitations.  The section number may be
  283.              1, ..., 8, and if it is specified, the volume title may be omit-
  284.              ted.  A volume title may be arbitrary or one of the following:
  285.  
  286.                    AMD    UNIX Ancestral Manual Documents
  287.                    SMM    UNIX System Manager's Manual
  288.                    URM    UNIX Reference Manual
  289.                    PRM    UNIX Programmer's Manual
  290.  
  291.              The default volume labeling is URM for sections 1, 6, and 7; SMM
  292.              for section 8; PRM for sections 2, 3, 4, and 5.
  293.  
  294.      .Os operating_system release#
  295.              The name of the operating system should be the common acronym,
  296.              e.g.  BSD or ATT. The release should be the standard release
  297.              nomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
  298.              V.4.  Unrecognized arguments are displayed as given in the page
  299.              footer.  For instance, a typical footer might be:
  300.  
  301.                    .Os BSD 4.3
  302.  
  303.              or for a locally produced set
  304.  
  305.                    .Os CS Department
  306.  
  307.              The Berkeley default, `.Os' without an argument, has been defined
  308.              as BSD Experimental in the site specific file
  309.              _/_u_s_r_/_s_r_c_/_s_h_a_r_e_/_t_m_a_c_/_d_o_c_-_c_o_m_m_o_n. It really should default to
  310.              LOCAL. Note, if the `.Os' macro is not present, the bottom left
  311.              corner of the page will be ugly.
  312.  
  313.      .Dd month day, year
  314.              The date should be written formally:
  315.  
  316.                    January 25, 1989
  317.  
  318. MMAANNUUAALL DDOOMMAAIINN
  319.    WWhhaatt''ss iinn aa nnaammee......
  320.      The manual domain macro names are derived from the day to day informal
  321.      language used to describe commands, subroutines and related files.
  322.      Slightly different variations of this language are used to describe the
  323.      three different aspects of writing a man page.  First, there is the de-
  324.      scription of --mmddoocc macro request usage.  Second is the description of a
  325.      UNIX command _w_i_t_h --mmddoocc macros and third, the description of a command to
  326.      a user in the verbal sense; that is, discussion of a command in the text
  327.      of a man page.
  328.  
  329.  
  330.      In the first case, troff(1) macros are themselves a type of command; the
  331.      general syntax for a troff command is:
  332.  
  333.            .Va argument1 argument2 ... argument9
  334.  
  335.      The `.Va' is a macro command or request, and anything following it is an
  336.      argument to be processed.  In the second case, the description of a UNIX
  337.      command using the content macros is a bit more involved; a typical
  338.      _S_Y_N_O_P_S_I_S command line might be displayed as:
  339.  
  340.            ffiilltteerr [--ffllaagg] _i_n_f_i_l_e _o_u_t_f_i_l_e
  341.  
  342.      Here, ffiilltteerr is the command name and the bracketed string --ffllaagg is a _f_l_a_g
  343.      argument designated as optional by the option brackets.  In --mmddoocc terms,
  344.      _i_n_f_i_l_e and _o_u_t_f_i_l_e are called _a_r_g_u_m_e_n_t_s. The macros which formatted the
  345.      above example:
  346.  
  347.            .Nm filter
  348.            .Op Fl flag
  349.            .Ar infile outfile
  350.  
  351.      In the third case, discussion of commands and command syntax includes
  352.      both examples above, but may add more detail.  The arguments _i_n_f_i_l_e and
  353.      _o_u_t_f_i_l_e from the example above might be referred to as _o_p_e_r_a_n_d_s or _f_i_l_e
  354.      _a_r_g_u_m_e_n_t_s. Some command line argument lists are quite long:
  355.  
  356.            mmaakkee  [--eeiikknnqqrrssttvv] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] [--ff _m_a_k_e_f_i_l_e]
  357.                  [--II _d_i_r_e_c_t_o_r_y] [--jj _m_a_x___j_o_b_s] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.]
  358.  
  359.      Here one might talk about the command mmaakkee and qualify the argument
  360.      _m_a_k_e_f_i_l_e, as an argument to the flag, --ff, or discuss the optional file
  361.      operand _t_a_r_g_e_t. In the verbal context, such detail can prevent confusion,
  362.      however the --mmddoocc package does not have a macro for an argument _t_o a
  363.      flag.  Instead the `Ar' argument macro is used for an operand or file ar-
  364.      gument like _t_a_r_g_e_t as well as an argument to a flag like _v_a_r_i_a_b_l_e. The
  365.      make command line was produced from:
  366.  
  367.            .Nm make
  368.            .Op Fl eiknqrstv
  369.            .Op Fl D Ar variable
  370.            .Op Fl d Ar flags
  371.            .Op Fl f Ar makefile
  372.            .Op Fl I Ar directory
  373.            .Op Fl j Ar max_jobs
  374.            .Op Ar variable=value
  375.            .Bk -words
  376.            .Op Ar target ...
  377.            .Ek
  378.  
  379.      The `.Bk' and `.Ek' macros are explained in _K_e_e_p_s.
  380.  
  381.    GGeenneerraall SSyynnttaaxx
  382.      The manual domain and general text domain macros share a similar syntax
  383.      with a few minor deviations: `.Ar', `.Fl', `.Nm', and `.Pa' differ only
  384.      when called without arguments; `.Fn' and `.Xr' impose an order on their
  385.      argument lists and the `.Op' and `.Fn' macros have nesting limitations.
  386.      All content macros are capable of recognizing and properly handling punc-
  387.      tuation, provided each punctuation character is separated by a leading
  388.      space.  If an request is given:
  389.  
  390.            .Li sptr, ptr),
  391.  
  392.      The result is:
  393.  
  394.            sptr, ptr),
  395.  
  396.  
  397.      The punctuation is not recognized and all is output in the literal font.
  398.      If the punctuation is separated by a leading white space:
  399.  
  400.            .Li sptr , ptr ) ,
  401.  
  402.      The result is:
  403.  
  404.            sptr, ptr),
  405.  
  406.      The punctuation is now recognized and is output in the default font dis-
  407.      tinguishing it from the strings in literal font.
  408.  
  409.      To remove the special meaning from a punctuation character escape it with
  410.      `\&'. Troff is limited as a macro language, and has difficulty when pre-
  411.      sented with a string containing a member of the mathematical, logical or
  412.      quotation set:
  413.  
  414.                  {+,-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
  415.  
  416.      The problem is that troff may assume it is supposed to actually perform
  417.      the operation or evaluation suggested by the characters.  To prevent the
  418.      accidental evaluation of these characters, escape them with `\&'. Typical
  419.      syntax is shown in the first content macro displayed below, `.Ad'.
  420.  
  421.    AAddddrreessss MMaaccrroo
  422.      The address macro identifies an address construct of the form addr1[,ad-
  423.      dr2[,addr3]].
  424.  
  425.            Usage: .Ad address ... { . , ; : ( ) [ ]}
  426.                    .Ad addr1           _a_d_d_r_1
  427.                    .Ad addr1 .         _a_d_d_r_1.
  428.                    .Ad addr1 , file2   _a_d_d_r_1, _f_i_l_e_2
  429.                    .Ad f1 , f2 , f3 :  _f_1, _f_2, _f_3:
  430.                    .Ad addr ) ) ,      _a_d_d_r)),
  431.  
  432.      It is an error to call .Ad without arguments.  .Ad is callable by other
  433.      macros and is parsed.
  434.  
  435.    AArrgguummeenntt MMaaccrroo
  436.      The .Ar argument macro may be used whenever a command line argument is
  437.      referenced.
  438.  
  439.            Usage: .Ar argument ... { . , ; : ( ) [ ]}
  440.                     .Ar              _f_i_l_e _._._.
  441.                     .Ar file1        _f_i_l_e_1
  442.                     .Ar file1 .      _f_i_l_e_1.
  443.                     .Ar file1 file2  _f_i_l_e_1 _f_i_l_e_2
  444.                     .Ar f1 f2 f3 :   _f_1 _f_2 _f_3:
  445.                     .Ar file ) ) ,   _f_i_l_e)),
  446.  
  447.      If .Ar is called without arguments `_f_i_l_e _._._.' is assumed.  The .Ar macro
  448.      is parsed and is callable.
  449.  
  450.    CCoonnffiigguurraattiioonn DDeeccllaarraattiioonn ((sseeccttiioonn ffoouurr oonnllyy))
  451.      The `.Cd' macro is used to demonstrate a config(8) declaration for a de-
  452.      vice interface in a section four manual.  This macro accepts quoted argu-
  453.      ments (double quotes only).
  454.  
  455.            ddeevviiccee llee00 aatt ssccooddee??  produced by: `.Cd device le0 at scode?'.
  456.  
  457.    CCoommmmaanndd MMooddiiffiieerr
  458.      The command modifier is identical to the `.Fl' (flag) command with the
  459.      exception the `.Cm' macro does not assert a dash in front of every argu-
  460.      ment.  Traditionally flags are marked by the preceding dash, some com-
  461.      mands or subsets of commands do not use them.  Command modifiers may also
  462.      be specified in conjunction with interactive commands such as editor com-
  463.      mands.  See _F_l_a_g_s.
  464.  
  465.    DDeeffiinneedd VVaarriiaabblleess
  466.      A variable which is defined in an include file is specified by the macro
  467.      `.Dv'.
  468.  
  469.            Usage: .Dv defined_variable ... { . , ; : ( ) [ ]}
  470.                    .Dv MAXHOSTNAMELEN  MAXHOSTNAMELEN
  471.                    .Dv TIOCGPGRP )     TIOCGPGRP)
  472.  
  473.      It is an error to call `.Dv' without arguments.  `.Dv' is parsed and is
  474.      callable.
  475.  
  476.    EErrrrnnoo''ss ((SSeeccttiioonn ttwwoo oonnllyy))
  477.      The `.Er' errno macro specifies the error return value for section two
  478.      library routines.  The second example below shows `.Er' used with the
  479.      `.Bq' general text domain macro, as it would be used in a section two
  480.      manual page.
  481.  
  482.            Usage: .Er ERRNOTYPE ... { . , ; : ( ) [ ]}
  483.                    .Er ENOENT      ENOENT
  484.                    .Er ENOENT ) ;  ENOENT);
  485.                    .Bq Er ENOTDIR  [ENOTDIR]
  486.  
  487.      It is an error to call `.Er' without arguments.  The `.Er' macro is
  488.      parsed and is callable.
  489.  
  490.    EEnnvviirroonnmmeenntt VVaarriiaabblleess
  491.      The `.Ev' macro specifies an environment variable.
  492.  
  493.            Usage: .Ev argument ... { . , ; : ( ) [ ]}
  494.                    .Ev DISPLAY        DISPLAY
  495.                    .Ev PATH .         PATH.
  496.                    .Ev PRINTER ) ) ,  PRINTER)),
  497.  
  498.      It is an error to call `.Ev' without arguments.  The `.Ev' macro is
  499.      parsed and is callable.
  500.  
  501.    FFuunnccttiioonn AArrgguummeenntt
  502.      The `.Fa' macro is used to refer to function arguments (parameters) out-
  503.      side of the _S_Y_N_O_P_S_I_S section of the manual or inside the _S_Y_N_O_P_S_I_S section
  504.      should a parameter list be too long for the `.Fn' macro and the enclosure
  505.      macros `.Fo' and `.Fc' must be used.  `.Fa' may also be used to refer to
  506.      structure members.
  507.  
  508.            Usage: .Fa function_argument ... { . , ; : ( ) [ ]}
  509.                    .Fa d_namlen ) ) ,  _d___n_a_m_l_e_n)),
  510.                    .Fa iov_len         _i_o_v___l_e_n
  511.  
  512.      It is an error to call `.Fa' without arguments.  `.Fa' is parsed and is
  513.      callable.
  514.  
  515.    FFuunnccttiioonn DDeeccllaarraattiioonn
  516.      The `.Fd' macro is used in the _S_Y_N_O_P_S_I_S section with section two or three
  517.      functions.  The `.Fd' macro does not call other macros and is not
  518.      callable by other macros.
  519.  
  520.            Usage: .Fd include_file (or defined variable)
  521.  
  522.      In the _S_Y_N_O_P_S_I_S section a `.Fd' request causes a line break if a function
  523.      has already been presented and a break has not occurred.  This leaves a
  524.      nice vertical space in between the previous function call and the decla-
  525.      ration for the next function.
  526.  
  527.  
  528.    FFllaaggss
  529.      The `.Fl' macro handles command line flags.  It prepends a dash, `-', to
  530.      the flag.  For interactive command flags, which are not prepended with a
  531.      dash, the `.Cm' (command modifier) macro is identical, but without the
  532.      dash.
  533.  
  534.            Usage: .Fl argument ... { . , ; : ( ) [ ]}
  535.                    .Fl           --
  536.                    .Fl cfv       --ccffvv
  537.                    .Fl cfv .     --ccffvv.
  538.                    .Fl s v t     --ss --vv --tt
  539.                    .Fl - ,       ----,
  540.                    .Fl xyz ) ,   --xxyyzz),
  541.  
  542.      The `.Fl' macro without any arguments results in a dash representing
  543.      stdin/stdout.  Note that giving `.Fl' a single dash, will result in two
  544.      dashes.  The `.Fl' macro is parsed and is callable.
  545.  
  546.    FFuunnccttiioonnss ((lliibbrraarryy rroouuttiinneess))
  547.      The .Fn macro is modeled on ANSI C conventions.
  548.  
  549.      Usage: .Fn [type] function [[type] parameters ... { . , ; : ( ) [ ]}]
  550.      .Fn getchar                             ggeettcchhaarr()
  551.      .Fn strlen ) ,                          ssttrrlleenn()),
  552.      .Fn "int align" "const * char *sptrs",  iinntt aalliiggnn(_c_o_n_s_t _* _c_h_a_r _*_s_p_t_r_s),
  553.  
  554.      It is an error to call `.Fn' without any arguments.  The `.Fn' macro is
  555.      parsed and is callable, note that any call to another macro signals the
  556.      end of the `.Fn' call (it will close-parenthesis at that point).
  557.  
  558.      For functions that have more than eight parameters (and this is rare),
  559.      the macros `.Fo' (function open) and `.Fc' (function close) may be used
  560.      with `.Fa' (function argument) to get around the limitation. For example:
  561.  
  562.            .Fo "int res_mkquery"
  563.            .Fa "int op"
  564.            .Fa "char *dname"
  565.            .Fa "int class"
  566.            .Fa "int type"
  567.            .Fa "char *data"
  568.            .Fa "int datalen"
  569.            .Fa "struct rrec *newrr"
  570.            .Fa "char *buf"
  571.            .Fa "int buflen"
  572.            .Fc
  573.  
  574.      Produces:
  575.  
  576.            iinntt rreess__mmkkqquueerryy(_i_n_t _o_p, _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e,
  577.            _c_h_a_r _*_d_a_t_a, _i_n_t _d_a_t_a_l_e_n, _s_t_r_u_c_t _r_r_e_c _*_n_e_w_r_r, _c_h_a_r _*_b_u_f, _i_n_t _b_u_f_l_e_n)
  578.  
  579.      The `.Fo' and `.Fc' macros are parsed and are callable.  In the _S_Y_N_O_P_S_I_S
  580.      section, the function will always begin at the beginning of line.  If
  581.      there is more than one function presented in the _S_Y_N_O_P_S_I_S section and a
  582.      function type has not been given, a line break will occur, leaving a nice
  583.      vertical space between the current function name and the one prior.  At
  584.      the moment, `.Fn' does not check its word boundaries against troff line
  585.      lengths and may split across a newline ungracefully.  This will be fixed
  586.      in the near future.
  587.  
  588.    FFuunnccttiioonn TTyyppee
  589.      This macro is intended for the _S_Y_N_O_P_S_I_S section.  It may be used anywhere
  590.      else in the man page without problems, but its main purpose is to present
  591.      the function type in kernel normal form for the _S_Y_N_O_P_S_I_S of sections two
  592.      and three (it causes a page break allowing the function name to appear on
  593.      the next line).
  594.  
  595.            Usage: .Ft type ... { . , ; : ( ) [ ]}
  596.                    .Ft struct stat  _s_t_r_u_c_t _s_t_a_t
  597.  
  598.      The `.Ft' request is not callable by other macros.
  599.  
  600.    IInntteerraaccttiivvee CCoommmmaannddss
  601.      The `.Ic' macro designates an interactive or internal command.
  602.  
  603.            Usage: .Li argument ... { . , ; : ( ) [ ]}
  604.                    .Ic :wq                  ::wwqq
  605.                    .Ic do while {...}       ddoo wwhhiillee {{......}}
  606.                    .Ic setenv , unsetenv    sseetteennvv, uunnsseetteennvv
  607.  
  608.      It is an error to call `.Ic' without arguments.  The `.Ic' macro is
  609.      parsed and is callable.
  610.  
  611.    LLiitteerraallss
  612.      The `.Li' literal macro may be used for special characters, variable con-
  613.      stants, anything which should be displayed as it would be typed.
  614.  
  615.            Usage: .Li argument ... { . , ; : ( ) [ ]}
  616.                    .Li \en          \n
  617.                    .Li M1 M2 M3 ;   M1 M2 M3;
  618.                    .Li cntrl-D ) ,  cntrl-D),
  619.                    .Li 1024 ...     1024 ...
  620.  
  621.      The `.Li' macro is parsed and is callable.
  622.  
  623.    NNaammee MMaaccrroo
  624.      The `.Nm' macro is used for the document title or subject name.  It has
  625.      the peculiarity of remembering the first argument it was called with,
  626.      which should always be the subject name of the page.  When called without
  627.      arguments, `.Nm' regurgitates this initial name for the sole purpose of
  628.      making less work for the author.  Note: a section two or three document
  629.      function name is addressed with the `.Nm' in the _N_A_M_E section, and with
  630.      `.Fn' in the _S_Y_N_O_P_S_I_S and remaining sections.  For interactive commands,
  631.      such as the `while' command keyword in csh(1),  the `.Ic' macro should be
  632.      used.  While the `.Ic' is nearly identical to `.Nm', it can not recall
  633.      the first argument it was invoked with.
  634.  
  635.            Usage: .Nm argument ... { . , ; : ( ) [ ]}
  636.                    .Nm mdoc.samples  mmddoocc..ssaammpplleess
  637.                    .Nm \-mdoc        --mmddoocc.
  638.                    .Nm foo ) ) ,     ffoooo)),
  639.                    .Nm               mmddoocc..ssaammpplleess
  640.  
  641.      The `.Nm' macro is parsed and is callable.
  642.  
  643.    OOppttiioonnss
  644.      The `.Op' macro places option brackets around the any remaining arguments
  645.      on the command line, and places any trailing punctuation outside the
  646.      brackets.  The macros `.Oc' and `.Oo' may be used across one or more
  647.      lines.
  648.  
  649.            Usage: .Op options ... { . , ; : ( ) [ ]}
  650.            .Op                                []
  651.            .Op Fl k                           [--kk]
  652.            .Op Fl k ) .                       [--kk]).
  653.            .Op Fl k Ar kookfile               [--kk _k_o_o_k_f_i_l_e]
  654.            .Op Fl k Ar kookfile ,             [--kk _k_o_o_k_f_i_l_e],
  655.            .Op Ar objfil Op Ar corfil         [_o_b_j_f_i_l [_c_o_r_f_i_l]]
  656.            .Op Fl c Ar objfil Op Ar corfil ,  [--cc _o_b_j_f_i_l [_c_o_r_f_i_l]],
  657.            .Op word1 word2                    [word1 word2]
  658.  
  659.  
  660.      The `.Oc' and `.Oo' macros:
  661.  
  662.            .Oo
  663.            .Op Fl k Ar kilobytes
  664.            .Op Fl i Ar interval
  665.            .Op Fl c Ar count
  666.            .Oc
  667.  
  668.      Produce: [[--kk _k_i_l_o_b_y_t_e_s] [--ii _i_n_t_e_r_v_a_l] [--cc _c_o_u_n_t]]
  669.  
  670.      The macros `.Op', `.Oc' and `.Oo' are parsed and are callable.
  671.  
  672.    PPaatthhnnaammeess
  673.      The `.Pa' macro formats path or file names.
  674.  
  675.            Usage: .Pa pathname { . , ; : ( ) [ ]}
  676.                    .Pa /usr/share         _/_u_s_r_/_s_h_a_r_e
  677.                    .Pa /tmp/fooXXXXX ) .  _/_t_m_p_/_f_o_o_X_X_X_X_X).
  678.  
  679.      The `.Pa' macro is parsed and is callable.
  680.  
  681.    VVaarriiaabblleess
  682.      Generic variable reference:
  683.  
  684.            Usage: .Va variable ... { . , ; : ( ) [ ]}
  685.                    .Va count           _c_o_u_n_t
  686.                    .Va settimer,       _s_e_t_t_i_m_e_r,
  687.                    .Va int *prt ) :    _i_n_t _*_p_r_t):
  688.                    .Va char s ] ) ) ,  _c_h_a_r _s])),
  689.  
  690.      It is an error to call `.Va' without any arguments.  The `.Va' macro is
  691.      parsed and is callable.
  692.  
  693.    MMaannuuaall PPaaggee CCrroossss RReeffeerreenncceess
  694.      The `.Xr' macro expects the first argument to be a manual page name, and
  695.      the second argument, if it exists, to be either a section page number or
  696.      punctuation.  Any remaining arguments are assumed to be punctuation.
  697.  
  698.            Usage: .Xr man_page [1,...,8] { . , ; : ( ) [ ]}
  699.                    .Xr mdoc          mdoc
  700.                    .Xr mdoc ,        mdoc,
  701.                    .Xr mdoc 7        mdoc(7)
  702.                    .Xr mdoc 7 ) ) ,  mdoc(7))),
  703.  
  704.      The `.Xr' macro is parsed and is callable.  It is an error to call `.Xr'
  705.      without any arguments.
  706.  
  707. GGEENNEERRAALL TTEEXXTT DDOOMMAAIINN
  708.    AATT&&TT MMaaccrroo
  709.            Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... { . , ; : ( ) [ ]}
  710.                    .At
  711.                    .At v6 .    Version 6 AT&T UNIX.
  712.  
  713.      The `.At' macro is _n_o_t parsed and _n_o_t callable. It accepts at most two
  714.      arguments.
  715.  
  716.    BBSSDD MMaaccrroo
  717.            Usage: .Bx [Version/release] ... { . , ; : ( ) [ ]}
  718.                    .Bx          BSD UNIX
  719.                    .Bx 4.3 .    4.3BSD.
  720.  
  721.      The `.Bx' macro is parsed and is callable.
  722.  
  723.    UUNNIIXX MMaaccrroo
  724.            Usage: .Ux ... { . , ; : ( ) [ ]}
  725.  
  726.                    .Ux          UNIX
  727.  
  728.      The `.Ux' macro is parsed and is callable.
  729.  
  730.    EEmmpphhaassiiss MMaaccrroo
  731.      Text may be stressed or emphasized with the `.Em' macro.  The usual font
  732.      for emphasis is italic.
  733.  
  734.            Usage: .Em argument ... { . , ; : ( ) [ ]}
  735.                    .Em does not          _d_o_e_s _n_o_t
  736.                    .Em exceed 1024 .     _e_x_c_e_e_d _1_0_2_4.
  737.                    .Em vide infra ) ) ,  _v_i_d_e _i_n_f_r_a)),
  738.  
  739.      The `.Em' macro is parsed and is callable.  It is an error to call `.Em'
  740.      without arguments.
  741.  
  742.    EEnncclloossuurree aanndd QQuuoottiinngg MMaaccrrooss
  743.      The concept of enclosure is similar to quoting.  The object being to en-
  744.      close one or more strings between a pair of characters like quotes or
  745.      parentheses.  The terms quoting and enclosure are used interchangeably
  746.      throughout this document.  Most of the one line enclosure macros end in
  747.      small letter `q' to give a hint of quoting, but there are a few irregu-
  748.      larities.  For each enclosure macro there is also a pair of open and
  749.      close macros which end in small letters `o' and `c' respectively.  These
  750.      can be used across one or more lines of text and while they have nesting
  751.      limitations, the one line quote macros can be used inside of them.
  752.  
  753.            _Q_u_o_t_e     _C_l_o_s_e    _O_p_e_n   _F_u_n_c_t_i_o_n                  _R_e_s_u_l_t
  754.            .Aq      .Ac      .Ao     Angle Bracket Enclosure   <string>
  755.            .Bq      .Bc      .Bo     Bracket Enclosure         [string]
  756.            .Dq      .Dc      .Do     Double Quote              ``string''
  757.                     .Ec      .Eo     Enclose String (in XX)    XXstringXX
  758.            .Pq      .Pc      .Po     Parenthesis Enclosure     (string)
  759.            .Ql                       Quoted Literal            `st' or string
  760.            .Qq      .Qc      .Qo     Straight Double Quote     "string"
  761.            .Sq      .Sc      .So     Single Quote              `string'
  762.  
  763.      Except for the irregular macros noted below, all of the quoting macros
  764.      are parsed and callable.  All handle punctuation properly, as long as it
  765.      is presented one character at a time and separated by spaces.  The quot-
  766.      ing macros examine opening and closing punctuation to determine whether
  767.      it comes before or after the enclosing string. This makes some nesting
  768.      possible.
  769.  
  770.      .Ec, .Eo  These macros expect the first argument to be the opening and
  771.                closing strings respectively.
  772.  
  773.      .Ql       The quoted literal macro behaves differently for troff than
  774.                nroff.  If formatted with nroff,  a quoted literal is always
  775.                quoted. If formatted with troff, an item is only quoted if the
  776.                width of the item is less than three constant width characters.
  777.                This is to make short strings more visible where the font
  778.                change to literal (constant width) is less noticeable.
  779.  
  780.      .Pf       The prefix macro is not callable, but it is parsed:
  781.  
  782.                      .Pf ( Fa name2
  783.                               becomes (_n_a_m_e_2.
  784.  
  785.                The `.Ns' (no space) macro performs the analogous suffix func-
  786.                tion.
  787.  
  788.      Examples of quoting:
  789.            .Aq                         <>
  790.  
  791.  
  792.            .Aq Ar ctype.h ) ,          <_c_t_y_p_e_._h>),
  793.            .Bq                         []
  794.            .Bq Em Greek , French .     [_G_r_e_e_k, _F_r_e_n_c_h].
  795.            .Dq                         ``''
  796.            .Dq string abc .            ``string abc''.
  797.            .Dq '^[A-Z]'                ``'^[A-Z]'''
  798.            .Ql man mdoc                `man mdoc'
  799.            .Qq                         ""
  800.            .Qq string ) ,              "string"),
  801.            .Qq string Ns ),            "string),"
  802.            .Sq                         `'
  803.            .Sq string                  `string'
  804.  
  805.      For a good example of nested enclosure macros, see the `.Op' option
  806.      macro.  It was created from the same underlying enclosure macros as those
  807.      presented in the list above.  The `.Xo' and `.Xc' extended argument list
  808.      macros were also built from the same underlying routines and are a good
  809.      example of --mmddoocc macro usage at its worst.
  810.  
  811.    NNoo--OOpp oorr NNoorrmmaall TTeexxtt MMaaccrroo
  812.      The macro .No is a hack for words in a macro command line which should
  813.      _n_o_t be formatted and follows the conventional syntax for content macros.
  814.  
  815.    NNoo SSppaaccee MMaaccrroo
  816.      The `.Ns' macro eliminates unwanted spaces in between macro requests.  It
  817.      is useful for old style argument lists where there is no space between
  818.      the flag and argument:
  819.  
  820.            .Op Fl I Ns Ar directory    produces [--II_d_i_r_e_c_t_o_r_y]
  821.  
  822.      Note: the `.Ns' macro always invokes the `.No' macro after eliminating
  823.      the space unless another macro name follows it.  The macro `.Ns' is
  824.      parsed and is callable.
  825.  
  826.    SSeeccttiioonn CCrroossss RReeffeerreenncceess
  827.      The `.Sx' macro designates a reference to a section header within the
  828.      same document.  It is parsed and is callable.
  829.  
  830.                    .Sx FILES     _F_I_L_E_S
  831.  
  832.    SSyymmbboolliicc
  833.      The symbolic emphasis macro is generally a boldface macro in either the
  834.      symbolic sense or the traditional English usage.
  835.  
  836.            Usage: .Sy symbol ... { . , ; : ( ) [ ]}
  837.                    .Sy Important Notice   IImmppoorrttaanntt NNoottiiccee
  838.  
  839.      The `.Sy' macro is parsed and is callable.  Arguments to `.Sy' may be
  840.      quoted.
  841.  
  842.    RReeffeerreenncceess aanndd CCiittaattiioonnss
  843.      The following macros make a modest attempt to handle references.  At
  844.      best, the macros make it convenient to manually drop in a subset of refer
  845.      style references.
  846.  
  847.            .Rs     Reference Start.  Causes a line break and begins collection
  848.                    of reference information until the reference end macro is
  849.                    read.
  850.            .Re     Reference End.  The reference is printed.
  851.            .%A     Reference author name, one name per invocation.
  852.            .%B     Book title.
  853.            .%C     City/place.
  854.            .%D     Date.
  855.            .%J     Journal name.
  856.  
  857.  
  858.            .%N     Issue number.
  859.            .%O     Optional information.
  860.            .%P     Page number.
  861.            .%R     Report name.
  862.            .%T     Title of article.
  863.            .%V     Volume(s).
  864.  
  865.      The macros beginning with `%' are not callable, and are parsed only for
  866.      the trade name macro which returns to its caller.  (And not very pre-
  867.      dictably at the moment either.)  The purpose is to allow trade names to
  868.      be pretty printed in troff/ditroff  output.
  869.  
  870.    TTrraaddee NNaammeess ((oorr AAccrroonnyymmss aanndd TTyyppee NNaammeess))
  871.      The trade name macro is generally a small caps macro for all upper case
  872.      words longer than two characters.
  873.  
  874.            Usage: .Tn symbol ... { . , ; : ( ) [ ]}
  875.                    .Tn DEC    DEC
  876.                    .Tn ASCII  ASCII
  877.  
  878.      The `.Tn' macro is parsed and is callable by other macros.
  879.  
  880.    EExxtteennddeedd AArrgguummeennttss
  881.      The .Xo and .Xc macros allow one to extend an argument list on a macro
  882.      boundary.  Argument lists cannot be extended within a macro which expects
  883.      all of its arguments on one line such as `.Op'.
  884.  
  885.      Here is an example of `.Xo' using the space mode macro to turn spacing
  886.      off:
  887.  
  888.            .Sm off
  889.            .It Xo Sy I Ar operation
  890.            .No \en Ar count No \en
  891.            .Xc
  892.            .Sm on
  893.  
  894.      Produces
  895.  
  896.            II_o_p_e_r_a_t_i_o_n\n_c_o_u_n_t\n
  897.  
  898.      Another one:
  899.  
  900.            .Sm off
  901.            .It Cm S No / Ar old_pattern Xo
  902.            .No / Ar new_pattern
  903.            .No / Op Cm g
  904.            .Xc
  905.            .Sm on
  906.  
  907.      Produces
  908.  
  909.            SS/_o_l_d___p_a_t_t_e_r_n/_n_e_w___p_a_t_t_e_r_n/[gg]
  910.  
  911.      Another example of `.Xo' and using enclosure macros: Test the value of an
  912.      variable.
  913.  
  914.            .It Xo
  915.            .Ic .ifndef
  916.            .Oo \&! Oc Ns Ar variable
  917.            .Op Ar operator variable ...
  918.            .Xc
  919.  
  920.      Produces
  921.  
  922.  
  923.  
  924.            ..iiffnnddeeff [!]_v_a_r_i_a_b_l_e [_o_p_e_r_a_t_o_r _v_a_r_i_a_b_l_e _._._.]
  925.  
  926.      All of the above examples have used the `.Xo' macro on the argument list
  927.      of the `.It' (list-item) macro.  The extend macros are not used very of-
  928.      ten, and when they are it is usually to extend the list-item argument
  929.      list.  Unfortunately, this is also where the extend macros are the most
  930.      finicky.  In the first two examples, spacing was turned off; in the
  931.      third, spacing was desired in part of the output but not all of it.  To
  932.      make these macros work in this situation make sure the `.Xo' and `.Xc'
  933.      macros are placed as shown in the third example.  If the `.Xo' macro is
  934.      not alone on the `.It' argument list, spacing will be unpredictable.  The
  935.      `.Ns' (no space macro) must not occur as the first or last macro on a
  936.      line in this situation.  Out of 900 manual pages (about 1500 actual
  937.      pages) currently released with BSD UNIX only fifteen use the `.Xo' macro.
  938.  
  939. PPAAGGEE SSTTRRUUCCTTUURREE DDOOMMAAIINN
  940.    SSeeccttiioonn HHeeaaddeerrss
  941.      The first three `.Sh' section header macros list below are required in
  942.      every man page.  The remaining section headers are recommended at the
  943.      discretion of the author writing the manual page.  The `.Sh' macro can
  944.      take up to nine arguments.  It is parsed and but is not callable.
  945.  
  946.      .Sh NAME      The `.Sh NAME' macro is mandatory.  If not specified, the
  947.                    headers, footers and page layout defaults will not be set
  948.                    and things will be rather unpleasant.  The _N_A_M_E section
  949.                    consists of at least three items.  The first is the `.Nm'
  950.                    name macro naming the subject of the man page.  The second
  951.                    is the Name Description macro, `.Nd', which separates the
  952.                    subject name from the third item, which is the description.
  953.                    The description should be the most terse and lucid possi-
  954.                    ble, as the space available is small.
  955.  
  956.      .Sh SYNOPSIS  The _S_Y_N_O_P_S_I_S section describes the typical usage of the
  957.                    subject of a man page.  The  macros required are either
  958.                    `.Nm', `.Cd', `.Fn', (and possibly `.Fo', `.Fc', `.Fd',
  959.                    `.Ft' macros).  The function name macro `.Fn' is required
  960.                    for manual page sections 2 and 3, the command and general
  961.                    name macro `.Nm' is required for sections 1, 5, 6, 7, 8.
  962.                    Section 4 manuals require a `.Nm, .Fd' or a `.Cd' configu-
  963.                    ration device usage macro.  Several other macros may be
  964.                    necessary to produce the synopsis line as shown below:
  965.  
  966.                          ccaatt [--bbeennssttuuvv] [--] _f_i_l_e _._._.
  967.  
  968.                    The following macros were used:
  969.  
  970.                          .Nm cat
  971.                          .Op Fl benstuv
  972.                          .Op Fl
  973.                          .Ar
  974.  
  975.                    NNoottee: The macros `.Op', `.Fl', and `.Ar' recognize the pipe
  976.                    bar character `|', so a command line such as:
  977.  
  978.                          .Op Fl a | Fl b
  979.  
  980.                    will not go orbital.  Troff normally interprets a | as a
  981.                    special operator.  See _P_R_E_D_E_F_I_N_E_D _S_T_R_I_N_G_S for a usable |
  982.                    character in other situations.
  983.  
  984.      .Sh DESCRIPTION
  985.                    In most cases the first text in the _D_E_S_C_R_I_P_T_I_O_N section is
  986.                    a brief paragraph on the command, function or file, fol-
  987.                    lowed by a lexical list of options and respective explana-
  988.                    tions.  To create such a list, the `.Bl' begin-list, `.It'
  989.                    list-item and `.El' end-list macros are used (see _L_i_s_t_s _a_n_d
  990.                    _C_o_l_u_m_n_s below).
  991.  
  992.      The following `.Sh' section headers are part of the preferred manual page
  993.      layout and must be used appropriately to maintain consistency.  They are
  994.      listed in the order in which they would be used.
  995.  
  996.      .Sh ENVIRONMENT
  997.                The _E_N_V_I_R_O_N_M_E_N_T section should reveal any related environment
  998.                variables and clues to their behavior and/or usage.
  999.  
  1000.      .Sh EXAMPLES
  1001.                There are several ways to create examples.  See the _E_X_A_M_P_L_E_S
  1002.                section below for details.
  1003.  
  1004.      .Sh FILES
  1005.                Files which are used or created by the man page subject should
  1006.                be listed via the `.Pa' macro in the _F_I_L_E_S section.
  1007.  
  1008.      .Sh SEE ALSO
  1009.                References to other material on the man page topic and cross
  1010.                references to other relevant man pages should be placed in the
  1011.                _S_E_E _A_L_S_O section.  Cross references are specified using the
  1012.                `.Xr' macro.  At this time refer(1) style references are not
  1013.                accommodated.
  1014.  
  1015.      .Sh STANDARDS
  1016.                If the command, library function or file adheres to a specific
  1017.                implementation such as IEEE Std1003.2 (``POSIX'') or ANSI
  1018.                C3.159-1989 (``ANSI C'') this should be noted here.  If the
  1019.                command does not adhere to any standard, its history should be
  1020.                noted in the _H_I_S_T_O_R_Y section.
  1021.  
  1022.      .Sh HISTORY
  1023.                Any command which does not adhere to any specific standards
  1024.                should be outlined historically in this section.
  1025.  
  1026.      .Sh AUTHORS
  1027.                Credits, if need be, should be placed here.
  1028.  
  1029.      .Sh DIAGNOSTICS
  1030.                Diagnostics from a command should be placed in this section.
  1031.  
  1032.      .Sh ERRORS
  1033.                Specific error handling, especially from library functions (man
  1034.                page sections 2 and 3) should go here.  The `.Er' macro is used
  1035.                to specify an errno.
  1036.  
  1037.      .Sh BUGS  Blatant problems with the topic go here...
  1038.  
  1039.      User specified `.Sh' sections may be added, for example, this section was
  1040.      set with:
  1041.  
  1042.                    .Sh PAGE LAYOUT MACROS
  1043.  
  1044.    PPaarraaggrraapphhss aanndd LLiinnee SSppaacciinngg..
  1045.  
  1046.      .Pp     The .Pp paragraph command may be used to specify a line space
  1047.              where necessary.  The macro is not necessary after a `.Sh' or
  1048.              `.Ss' macro or before a `.Bl' macro.  (The `.Bl' macro asserts a
  1049.              vertical distance unless the -compact flag is given).
  1050.  
  1051.    KKeeeeppss
  1052.      The only keep that is implemented at this time is for words.  The macros
  1053.      are `.Bk' (begin-keep) and `.Ek' (end-keep).  The only option that `.Bl'
  1054.      accepts is --wwoorrddss and is useful for preventing line breaks in the middle
  1055.      of options.  In the example for the make command line arguments (see
  1056.      _W_h_a_t_'_s _i_n _a _n_a_m_e), the keep prevented nroff from placing up the flag and
  1057.      the argument on separate lines.  (Actually, the option macro used to pre-
  1058.      vent this from occurring, but was dropped when the decision (religious)
  1059.      was made to force right justified margins in troff as options in general
  1060.      look atrocious when spread across a sparse line.  More work needs to be
  1061.      done with the keep macros, a --lliinnee option needs to be added.)
  1062.  
  1063.    EExxaammpplleess aanndd DDiissppllaayyss
  1064.      There are five types of displays, a quickie one line indented display
  1065.      `.D1', a quickie one line literal display `.Dl', and a block literal,
  1066.      block filled and block ragged which use the `.Bd' begin-display and `.Ed'
  1067.      end-display macros.
  1068.  
  1069.      .D1    (D-one) Display one line of indented text.  This macro is parsed,
  1070.             but it is not callable.
  1071.  
  1072.                   --llddgghhffssttrruu
  1073.  
  1074.             The above was produced by: .Dl --llddgghhffssttrruu.
  1075.  
  1076.      .Dl    (D-ell) Display one line of indented _l_i_t_e_r_a_l text.  The `.Dl' ex-
  1077.             ample macro has been used throughout this file.  It allows the in-
  1078.             dent (display) of one line of text.  Its default font is set to
  1079.             constant width (literal) however it is parsed and will recognized
  1080.             other macros.  It is not callable however.
  1081.  
  1082.                   % ls -ldg /usr/local/bin
  1083.  
  1084.             The above was produced by .Dl % ls -ldg /usr/local/bin.
  1085.  
  1086.      .Bd    Begin-display.  The `.Bd' display must be ended with the `.Ed'
  1087.             macro.  Displays may be nested within displays and lists.  `.Bd'
  1088.             has the following syntax:
  1089.  
  1090.                   .Bd display-type [-offset offset_value] [-compact]
  1091.  
  1092.             The display-type must be one of the following four types and may
  1093.             have an offset specifier for indentation: `.Bd'.
  1094.  
  1095.             --rraaggggeedd           Display a block of text as typed, right (and
  1096.                               left) margin edges are left ragged.
  1097.             --ffiilllleedd           Display a filled (formatted) block.  The block
  1098.                               of text is formatted (the edges are filled - not
  1099.                               left unjustified).
  1100.             --lliitteerraall          Display a literal block, useful for source code
  1101.                               or simple tabbed or spaced text.
  1102.             --ffiillee _f_i_l_e___n_a_m_e   The file name following the --ffiillee flag is read
  1103.                               and displayed.  Literal mode is asserted and
  1104.                               tabs are set at 8 constant width character in-
  1105.                               tervals, however any troff/--mmddoocc  commands in
  1106.                               file will be processed.
  1107.             --ooffffsseett _s_t_r_i_n_g    If --ooffffsseett is specified with one of the follow-
  1108.                               ing strings, the string is interpreted to indi-
  1109.                               cate the level of indentation for the forthcom-
  1110.                               ing block of text:
  1111.  
  1112.                               _l_e_f_t        Align block on the current left mar-
  1113.                                           gin, this is the default mode of
  1114.                                           `.Bd'.
  1115.                               _c_e_n_t_e_r      Supposedly center the block.  At
  1116.                                           this time unfortunately, the block
  1117.                                           merely gets left aligned about an
  1118.                                           imaginary center margin.
  1119.                               _i_n_d_e_n_t      Indents by one default indent value
  1120.                                           or tab.  The default indent value is
  1121.                                           also used for the `.D1' display so
  1122.                                           one is guaranteed the two types of
  1123.                                           displays will line up.  This indent
  1124.                                           is normally set to 6n or about two
  1125.                                           thirds of an inch (six constant
  1126.                                           width characters).
  1127.                               _i_n_d_e_n_t_-_t_w_o  Indents two times the default indent
  1128.                                           value.
  1129.                               _r_i_g_h_t       This _l_e_f_t aligns the block about two
  1130.                                           inches from the right side of the
  1131.                                           page.  This macro needs work and
  1132.                                           perhaps may never do the right thing
  1133.                                           by troff.
  1134.  
  1135.      .Ed    End-display.
  1136.  
  1137.    TTaaggggeedd LLiissttss aanndd CCoolluummnnss
  1138.      There are several types of lists which may be initiated with the `.Bl'
  1139.      begin-list macro.  Items within the list are specified with the `.It'
  1140.      item macro and each list must end with the `.El' macro.  Lists may be
  1141.      nested within themselves and within displays.  Columns may be used inside
  1142.      of lists, but lists are unproven inside of columns.
  1143.  
  1144.      In addition, several list attributes may be specified such as the width
  1145.      of a tag, the list offset, and compactness (blank lines between items al-
  1146.      lowed or disallowed).  Most of this document has been formatted with a
  1147.      tag style list (--ttaagg). For a change of pace, the list-type used to pre-
  1148.      sent the list-types is an over-hanging list (--oohhaanngg). This type of list
  1149.      is quite popular with TeX users, but might look a bit funny after having
  1150.      read many pages of tagged lists.  The following list types are accepted
  1151.      by `.Bl':
  1152.  
  1153.      --bbuulllleett
  1154.      --iitteemm
  1155.      --eennuumm
  1156.      These three are the simplest types of lists.  Once the `.Bl' macro has
  1157.      been given, items in the list are merely indicated by a line consisting
  1158.      solely of the `.It' macro.  For example, the source text for a simple
  1159.      enumerated list would look like:
  1160.  
  1161.                  .Bl -enum -compact
  1162.                  .It
  1163.                  Item one goes here.
  1164.                  .It
  1165.                  And item two here.
  1166.                  .It
  1167.                  Lastly item three goes here.
  1168.                  .El
  1169.  
  1170.      The results:
  1171.  
  1172.                1.   Item one goes here.
  1173.                2.   And item two here.
  1174.                3.   Lastly item three goes here.
  1175.  
  1176.      A simple bullet list construction:
  1177.  
  1178.                  .Bl -bullet -compact
  1179.                  .It
  1180.                  Bullet one goes here.
  1181.                  .It
  1182.                  Bullet two here.
  1183.                  .El
  1184.  
  1185.      Produces:
  1186.  
  1187.  
  1188.                ++oo   Bullet one goes here.
  1189.                ++oo   Bullet two here.
  1190.  
  1191.      --ttaagg
  1192.      --ddiiaagg
  1193.      --hhaanngg
  1194.      --oohhaanngg
  1195.      --iinnsseett
  1196.      These list-types collect arguments specified with the `.It' macro and
  1197.      create a label which may be _i_n_s_e_t into the forthcoming text, _h_a_n_g_e_d from
  1198.      the forthcoming text, _o_v_e_r_h_a_n_g_e_d from above and not indented or _t_a_g_g_e_d.
  1199.      This list was constructed with the `--oohhaanngg' list-type.  The `.It' macro
  1200.      is parsed only for the inset, hang and tag list-types and is not
  1201.      callable.  Here is an example of inset labels:
  1202.  
  1203.            _T_a_g The tagged list (also called a tagged paragraph) is the most
  1204.            common type of list used in the Berkeley manuals.
  1205.  
  1206.            _D_i_a_g Diag lists create section four diagnostic lists and are simi-
  1207.            lar to inset lists except callable macros are ignored.
  1208.  
  1209.            _H_a_n_g Hanged labels are a matter of taste.
  1210.  
  1211.            _O_h_a_n_g Overhanging labels are nice when space is constrained.
  1212.  
  1213.            _I_n_s_e_t Inset labels are useful for controlling blocks of paragraphs
  1214.            and are valuable for converting --mmddoocc manuals to other formats.
  1215.  
  1216.      Here is the source text which produced the above example:
  1217.  
  1218.            .Bl -inset -offset indent
  1219.            .It Em Tag
  1220.            The tagged list (also called a tagged paragraph) is the
  1221.            most common type of list used in the Berkeley manuals.
  1222.            .It Em Diag
  1223.            Diag lists create section four diagnostic lists
  1224.            and are similar to inset lists except callable
  1225.            macros are ignored.
  1226.            .It Em Hang
  1227.            Hanged labels are a matter of taste.
  1228.            .It Em Ohang
  1229.            Overhanging labels are nice when space is constrained.
  1230.            .It Em Inset
  1231.            Inset labels are useful for controlling blocks of
  1232.            paragraphs and are valuable for converting
  1233.            .Nm -mdoc
  1234.            manuals to other formats.
  1235.            .El
  1236.  
  1237.      Here is a hanged list with just one item:
  1238.  
  1239.            _H_a_n_g_e_d labels appear similar to tagged lists when the label is
  1240.                    smaller than the label width.
  1241.  
  1242.            _L_o_n_g_e_r _h_a_n_g_e_d _l_i_s_t _l_a_b_e_l_s blend in to the paragraph unlike tagged
  1243.                    paragraph labels.
  1244.  
  1245.      And the unformatted text which created it:
  1246.  
  1247.            .Bl -hang -offset indent
  1248.            .It Em Hanged
  1249.            labels appear similar to tagged lists when the
  1250.            label is smaller than the label width.
  1251.            .It Em Longer hanged list labels
  1252.            blend in to the paragraph unlike
  1253.            tagged paragraph labels.
  1254.            .El
  1255.  
  1256.      The tagged list which follows uses an optional width specifier to control
  1257.      the width of the tag.
  1258.  
  1259.            SL      sleep time of the process (seconds blocked)
  1260.            PAGEIN  number of disk I/O's resulting from references by the pro-
  1261.                    cess to pages not loaded in core.
  1262.            UID     numerical user-id of process owner
  1263.            PPID    numerical id of parent of process process priority (non-
  1264.                    positive when in non-interruptible wait)
  1265.  
  1266.      The raw text:
  1267.  
  1268.            .Bl -tag -width "PAGEIN" -compact -offset indent
  1269.            .It SL
  1270.            sleep time of the process (seconds blocked)
  1271.            .It PAGEIN
  1272.            number of disk
  1273.            .Tn I/O Ns 's
  1274.            resulting from references
  1275.            by the process to pages not loaded in core.
  1276.            .It UID
  1277.            numerical user-id of process owner
  1278.            .It PPID
  1279.            numerical id of parent of process process priority
  1280.            (non-positive when in non-interruptible wait)
  1281.            .El
  1282.  
  1283.      Acceptable width specifiers:
  1284.  
  1285.            --wwiiddtthh _F_l     sets the width to the default width for a flag.  All
  1286.                          callable macros have a default width value.  The
  1287.                          `.Fl', value is presently set to ten constant width
  1288.                          characters or about five sixth of an inch.
  1289.  
  1290.            --wwiiddtthh _2_4_n    sets the width to 24 constant width characters or
  1291.                          about two inches.  The `n' is absolutely necessary
  1292.                          for the scaling to work correctly.
  1293.  
  1294.            --wwiiddtthh _E_N_A_M_E_T_O_O_L_O_N_G
  1295.                          sets width to the constant width length of the string
  1296.                          given.
  1297.  
  1298.            --wwiiddtthh _"_i_n_t _m_k_f_i_f_o_"
  1299.                          again, the width is set to the constant width of the
  1300.                          string given.
  1301.  
  1302.      If a width is not specified for the tag list type, the first time `.It'
  1303.      is invoked, an attempt is made to determine an appropriate width.  If the
  1304.      first argument to `.It' is a callable macro, the default width for that
  1305.      macro will be used as if the macro name had been supplied as the width.
  1306.      However, if another item in the list is given with a different callable
  1307.      macro name, a new and nested list is assumed.
  1308.  
  1309. PPRREEDDEEFFIINNEEDD SSTTRRIINNGGSS
  1310.      The following strings are predefined as may be used by preceding with the
  1311.      troff string interpreting sequence `\*(xx' where _x_x is the name of the
  1312.      defined string or as `\*x' where _x is the name of the string.  The inter-
  1313.      preting sequence may be used any where in the text.
  1314.  
  1315.            SSttrriinngg     NNrrooffff     TTrrooffff
  1316.            <=         <=        <=
  1317.            >=         >=        >=
  1318.  
  1319.  
  1320.            Rq         ''        ''
  1321.            Lq         ``        ``
  1322.            ua         ^         ^
  1323.            aa         '
  1324.            ga         `         `
  1325.            q          "         "
  1326.            Pi         pi        pi
  1327.            Ne         !=        !=
  1328.            Le         <=        <=
  1329.            Ge         >=        >=
  1330.            Lt         <         >
  1331.            Gt         >         <
  1332.            Pm         +-        +-
  1333.            If         infinity  infinity
  1334.            Na         _N_a_N       _N_a_N
  1335.            Ba         |         |
  1336.  
  1337.      NNoottee: The string named `q' should be written as `\*q' since it is only
  1338.      one char.
  1339.  
  1340. DDIIAAGGNNOOSSTTIICCSS
  1341.      The debugging facilities for --mmddoocc are limited, but can help detect sub-
  1342.      tle errors such as the collision of an argument name with an internal
  1343.      register or macro name.  (A what?)  A register is an arithmetic storage
  1344.      class for troff with a one or two character name.  All registers internal
  1345.      to --mmddoocc for troff and ditroff are two characters and of the form <up-
  1346.      per_case><lower_case> such as `Ar', <lower_case><upper_case> as `aR' or
  1347.      <upper or lower letter><digit> as `C1'. And adding to the muddle, troff
  1348.      has its own internal registers all of which are either two lower case
  1349.      characters or a dot plus a letter or meta-character character.  In one of
  1350.      the introduction examples, it was shown how to prevent the interpretation
  1351.      of a macro name with the escape sequence `\&'. This is sufficient for the
  1352.      internal register names also.
  1353.  
  1354.      If a non-escaped register name is given in the argument list of a request
  1355.      unpredictable behavior will occur.  In general, any time huge portions of
  1356.      text do not appear where expected in the output, or small strings such as
  1357.      list tags disappear, chances are there is a misunderstanding about an ar-
  1358.      gument type in the argument list.  Your mother never intended for you to
  1359.      remember this evil stuff - so here is a way to find out whether or not
  1360.      your arguments are valid: The `.Db' (debug) macro displays the interpre-
  1361.      tation of the argument list for most macros.  Macros such as the `.Pp'
  1362.      (paragraph) macro do not contain debugging information.  All of the
  1363.      callable macros do, and it is strongly advised whenever in doubt, turn on
  1364.      the `.Db' macro.
  1365.  
  1366.            Usage: .Db [on | off]
  1367.  
  1368.      An example of a portion of text with the debug macro placed above and be-
  1369.      low an artificially created problem (a flag argument `aC' which should be
  1370.      `\&aC' in order to work):
  1371.  
  1372.            .Db on
  1373.            .Op Fl aC Ar file )
  1374.            .Db off
  1375.  
  1376.      The resulting output:
  1377.  
  1378.            DEBUGGING ON
  1379.            DEBUG(argv) MACRO: `.Op'  Line #: 2
  1380.                    Argc: 1  Argv: `Fl'  Length: 2
  1381.                    Space: `'  Class: Executable
  1382.                    Argc: 2  Argv: `aC'  Length: 2
  1383.                    Space: `'  Class: Executable
  1384.                    Argc: 3  Argv: `Ar'  Length: 2
  1385.                    Space: `'  Class: Executable
  1386.                    Argc: 4  Argv: `file'  Length: 4
  1387.                    Space: ` '  Class: String
  1388.                    Argc: 5  Argv: `)'  Length: 1
  1389.                    Space: ` '  Class: Closing Punctuation or suffix
  1390.                    MACRO REQUEST: .Op Fl aC Ar file )
  1391.            DEBUGGING OFF
  1392.  
  1393.      The first line of information tells the name of the calling macro, here
  1394.      `.Op', and the line number it appears on.  If one or more files are in-
  1395.      volved (especially if text from another file is included) the line number
  1396.      may be bogus.  If there is only one file, it should be accurate.  The
  1397.      second line gives the argument count, the argument (`Fl') and its length.
  1398.      If the length of an argument is two characters, the argument is tested to
  1399.      see if it is executable (unfortunately, any register which contains a
  1400.      non-zero value appears executable).  The third line gives the space al-
  1401.      lotted for a class, and the class type.  The problem here is the argument
  1402.      aC should not be executable.  The four types of classes are string, exe-
  1403.      cutable, closing punctuation and opening punctuation.  The last line
  1404.      shows the entire argument list as it was read.  In this next example, the
  1405.      offending `aC' is escaped:
  1406.  
  1407.            .Db on
  1408.            .Em An escaped \&aC
  1409.            .Db off
  1410.  
  1411.            DEBUGGING ON
  1412.            DEBUG(fargv) MACRO: `.Em'  Line #: 2
  1413.                    Argc: 1  Argv: `An'  Length: 2
  1414.                    Space: ` '  Class: String
  1415.                    Argc: 2  Argv: `escaped'  Length: 7
  1416.                    Space: ` '  Class: String
  1417.                    Argc: 3  Argv: `aC'  Length: 2
  1418.                    Space: ` '  Class: String
  1419.                    MACRO REQUEST: .Em An escaped &aC
  1420.            DEBUGGING OFF
  1421.  
  1422.      The argument `\&aC' shows up with the same length of 2 as the `\&' se-
  1423.      quence produces a zero width, but a register named `\&aC' was not found
  1424.      and the type classified as string.
  1425.  
  1426.      Other diagnostics consist of usage statements and are self explanatory.
  1427.  
  1428. GGRROOFFFF,, TTRROOFFFF AANNDD NNRROOFFFF
  1429.      The --mmddoocc package does not need compatibility mode with groff.
  1430.  
  1431.      The package inhibits page breaks, and the headers and footers which nor-
  1432.      mally occur at those breaks with nroff,  to make the manual more effi-
  1433.      cient for viewing on-line.  At the moment, groff with --TT_a_s_c_i_i does eject
  1434.      the imaginary remainder of the page at end of file.  The inhibiting of
  1435.      the page breaks makes nroff'd  files unsuitable for hardcopy.  There is a
  1436.      register named `cR' which can be set to zero in the site dependent style
  1437.      file _/_u_s_r_/_s_r_c_/_s_h_a_r_e_/_t_m_a_c_/_d_o_c_-_n_r_o_f_f to restore the old style behavior.
  1438.  
  1439. FFIILLEESS
  1440.      /usr/share/tmac/tmac.doc      manual macro package
  1441.      /usr/share/man0/template.doc  template for writing a man page
  1442.  
  1443. SSEEEE AALLSSOO
  1444.      mdoc(7),  man(1),  troff(1)
  1445.  
  1446. BBUUGGSS
  1447.      Undesirable hyphenation on the dash of a flag argument is not yet re-
  1448.      solved, and causes occasional mishaps in the _D_E_S_C_R_I_P_T_I_O_N section.  (line
  1449.      break on the hyphen).
  1450.  
  1451.  
  1452.      Predefined strings are not declared in documentation.
  1453.  
  1454.      Section 3f has not been added to the header routines.
  1455.  
  1456.      `.Nm' font should be changed in _N_A_M_E section.
  1457.  
  1458.      `.Fn' needs to have a check to prevent splitting up if the line length is
  1459.      too short.  Occasionally it separates the last parenthesis, and sometimes
  1460.      looks ridiculous if a line is in fill mode.
  1461.  
  1462.      The method used to prevent header and footer page breaks (other than the
  1463.      initial header and footer) when using nroff occasionally places an un-
  1464.      sightly partially filled line (blank) at the would be bottom of the page.
  1465.  
  1466.      The list and display macros to not do any keeps and certainly should be
  1467.      able to.
  1468.  
  1469. BSD Experimental               December 30, 1993                            23
  1470.